<%--
  Created by IntelliJ IDEA.
  User: lanpeng
  Date: 2019-06-11
  Time: 11:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%=request.getRemoteHost()%><br>
<%=request.getServerPort()%> <br>
<%=request.getRequestURI() %>
<form name="form1"  method="post" action="toadd.jsp">
    <table width="445" border="0" align="center" cellpadding="0" cellspacing="0" style="border:#99CC00 solid 2px">
        <tr>
            <td  colspan="2" align="center" bordercolor="#00CCFF">
                <table width="68%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                </table>登录用户名：<input type="text" id="userName" name="userName" value="" />

                <table width="68%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                </table>登录密码：<input type="text" id="passWord" name="passWord" value="" />

                <table width="68%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                </table>老铁牛客户号：<input type="text"  id="custerCode" name="custerCode" value="" />

                <table width="68%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                </table>老铁牛客户名称：<input type="text" id="custerName" name="custerName" value="" />

                <table width="68%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                </table>客户类型(1:消费者，2:商家)：<input type="text"  id="inCome" name="inCome" value="" />

                <table width="68%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                </table>实名类型(1:个人，2:企业)：<input type="text" id="accountType" name="accountType" value="" />
            </td>
        </tr>
        <tr>
            <td height="36" colspan="2" align="center"><input type="submit" value="确认提交" />提交提交</td>
        </tr>
    </table>
</form>

<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
    function checkUser() {
        var param = {};
        param['userName'] = $("#userName").val();
        param['passWord'] = $("#passWord").val();
        param['custerCode'] = $("#custerCode").val();
        param['custerName'] = $("#custerName").val();
        param['inCome'] = $("#inCome").val();
        param['accountType'] = $("#accountType").val();

        var str =JSON.stringify(param);
        alert("json:" + str);
        $.ajax({
            url:"/api/addUser",
            type:"POST",
            contentType: "application/json; charset=utf-8",
            data:str,
            dataType:'json',
            success:function (data) {
                alert(JSON.stringify(data));
            },
            error:function () {
                alert("网络错误!!");
            }
        })
    }
</script>

</body>
</html>
